﻿@using CleanArchitecture.Core.Helper
@using CleanArchitecture.Infrastructure.Models.AdminUsers
@model AdminUserModel
<div id="accountinfo" class="layui-card layui-hide">
    <div class="layui-card-header">设置我的资料</div>
    <div class="layui-card-body">
        <div class="layui-row layui-col-space5">
            <div class="layui-col-md8">
                <div class="layui-form" lay-filter="">
                    <div class="layui-form-item">
                        <label class="layui-form-label">@(ReflectionExtensions.GetPropertyDisplayName<AdminUserModel>(m => m.AvailableAdminRoles))</label>
                        <div class="layui-form-mid layui-word-aux">
                            @foreach (var selectedRole in Model.AvailableAdminRoles)
                            {
                                if (selectedRole.Selected)
                                {
                                    <span class="layui-badge layui-bg-orange">@selectedRole.Text</span>
                                }
                            }
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">@(ReflectionExtensions.GetPropertyDisplayName<AdminUserModel>(m => m.LastLoginIpAddress))</label>
                        <div class="layui-input-inline">
                            <input type="text" name="@Model.nameof(m => m.LastLoginIpAddress)" value="@Model.LastLoginIpAddress" autocomplete="off" class="layui-input" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">@(ReflectionExtensions.GetPropertyDisplayName<AdminUserModel>(m => m.LastLoginTime))</label>
                        <div class="layui-input-inline">
                            <input type="text" name="@Model.nameof(m => m.LastLoginTime)" value="@Model.LastLoginTime" autocomplete="off" class="layui-input" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">@(ReflectionExtensions.GetPropertyDisplayName<AdminUserModel>(m => m.UserLoginName))</label>
                        <div class="layui-input-inline">
                            <input type="text" name="@Model.nameof(m => m.UserLoginName)" value="@Model.UserLoginName" readonly="" class="layui-input" />
                        </div>
                        <div class="layui-form-mid layui-word-aux">不可修改。一般用于后台登入名</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">@(ReflectionExtensions.GetPropertyDisplayName<AdminUserModel>(m => m.UserName))</label>
                        <div class="layui-input-inline">
                            <input type="text" name="@Model.nameof(m => m.UserName)" value="@Model.UserName" autocomplete="off" placeholder="请输入账号显示名称" class="layui-input" lay-verify="required">
                        </div>
                        <a href="javascript:;" id="updateUsername" data-id="@Model.Id" data-origindata='@Model.UserName'>修改</a>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">@(ReflectionExtensions.GetPropertyDisplayName<AdminUserModel>(m => m.IsActive))</label>
                        <div class="layui-input-block">
                            <input type="checkbox" name="switch" lay-skin="switch" lay-text="正常|锁定" disabled @if (Model.IsActive > 0) { <text>checked</text> } >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">@(ReflectionExtensions.GetPropertyDisplayName<AdminUserModel>(m => m.Mobile))</label>
                        <div class="layui-input-inline">
                            <input type="text" name="@Model.nameof(m => m.Mobile)" value="@Model.Mobile" lay-verify="phone" autocomplete="off" class="layui-input" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">@(ReflectionExtensions.GetPropertyDisplayName<AdminUserModel>(m => m.Email))</label>
                        <div class="layui-input-inline">
                            <input type="text" name="@Model.nameof(m => m.Email)" value="@Model.Email" lay-verify="email" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-col-md4">
                <div class="layui-form-item">@(ReflectionExtensions.GetPropertyDisplayName<AdminUserModel>(m => m.FaceImageUrl))</div>
                <div class="layui-form-item">
                    <img id="avatar" alt="avatar" />
                    <input name="@Model.nameof(m => m.FaceImageUrl)" value="@Model.FaceImageUrl" class="layui-hide" type="text" />
                    <input name="@Model.nameof(m => m.Id)" value="@Model.Id" type="text" class="layui-hide" />
                </div>
                <div class="layui-form-item">
                    <button type="button" class="layui-btn layui-btn-primary" id="LAY_avatarUpload">
                        <i class="layui-icon">&#xe67c;</i>上传图片
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>